package com.cc.service.Impl;

import com.cc.entity.Role;
import com.cc.mapper.RoleMapper;
import com.cc.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    RoleMapper roleMapper;

    @Override
    public List<Role> selectRole() {
        System.out.println("查询");
        return roleMapper.selectRole();
    }

    @Override
    @Transactional
    public void insertRole(String name) {
        System.out.println("保存用户角色");

        Role role = new Role();
        role.setRoleName("admin");
        roleMapper.insertRole(role);
    }
}
